﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace QYmall.Core.Model.Models
{
    /// <summary>
    /// 积分兑换记录
    /// </summary>
    public class ShopConvertHistory
    {
        /// <summary>
        /// 自增ID
        /// </summary>
        [Display(Name = "自增ID")]
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public long Id { get; set; }

        /// <summary>
        /// 兑换活动ID
        /// </summary>
        [Display(Name = "兑换活动")]
        [ForeignKey("ShopConvert")]
        public long ConvertId { get; set; }

        /// <summary>
        /// 所属订单ID
        /// </summary>
        [Display(Name = "所属订单")]
        [ForeignKey("Order")]
        public long OrderId { get; set; }

        /// <summary>
        /// 所属用户ID
        /// </summary>
        [Display(Name = "所属用户")]
        public int UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [Display(Name = "用户名")]
        [StringLength(128)]
        public string? UserName { get; set; }

        /// <summary>
        /// 状态(0进行1成功2失败)
        /// </summary>
        [Display(Name = "状态")]
        public byte Status { get; set; } = 0;

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime AddTime { get; set; } = DateTime.Now;


        /// <summary>
        /// 兑换活动信息
        /// </summary>
        public ShopConvert? ShopConvert { get; set; }

        /// <summary>
        /// 订单信息
        /// </summary>
        public Orders? Order { get; set; }
    }
}
